<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/**
<span class='line'>  2</span>  * @fileoverview 异步文件上传组件
<span class='line'>  3</span>  * @author 剑平（明河）&lt;minghe36@126.com>,紫英&lt;daxingplay@gmail.com>
<span class='line'>  4</span>  **/</span><span class="WHIT">
<span class='line'>  5</span> </span><span class="NAME">KISSY.add</span><span class="PUNC">(</span><span class="STRN">'gallery/form/1.0/uploader/base'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">S</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">Base</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">Node</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">UrlsInput</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">IframeType</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">AjaxType</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">FlashType</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>  6</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">EMPTY</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">$</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Node.all</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">LOG_PREFIX</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'[uploader]:'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>  7</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>  8</span>      * @name Uploader
<span class='line'>  9</span>      * @class 异步文件上传组件，支持ajax、flash、iframe三种方案
<span class='line'> 10</span>      * @constructor
<span class='line'> 11</span>      * @extends Base
<span class='line'> 12</span>      * @requires UrlsInput
<span class='line'> 13</span>      * @requires IframeType
<span class='line'> 14</span>      * @requires  AjaxType
<span class='line'> 15</span>      * @param {Object} config 组件配置（下面的参数为配置项，配置会写入属性，详细的配置说明请看属性部分）
<span class='line'> 16</span>      * @param {Button} config.button *，Button按钮的实例
<span class='line'> 17</span>      * @param {Queue} config.queue *，Queue队列的实例
<span class='line'> 18</span>      * @param {String|Array} config.type *，采用的上传方案
<span class='line'> 19</span>      * @param {Object} config.serverConfig *，服务器端配置
<span class='line'> 20</span>      * @param {String} config.urlsInputName *，存储文件路径的隐藏域的name名
<span class='line'> 21</span>      * @param {Boolean} config.isAllowUpload 是否允许上传文件
<span class='line'> 22</span>      * @param {Boolean} config.autoUpload 是否自动上传
<span class='line'> 23</span>      * @example
<span class='line'> 24</span>      * var uploader = new Uploader({button:button,queue:queue,serverConfig:{action:'test.php'}})
<span class='line'> 25</span>      */</span><span class="WHIT">
<span class='line'> 26</span> </span><span class="WHIT">    </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">Uploader</span><span class="PUNC">(</span><span class="NAME">config</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 27</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 28</span> </span><span class="WHIT">        </span><span class="COMM">//调用父类构造函数</span><span class="WHIT">
<span class='line'> 29</span> </span><span class="WHIT">        </span><span class="NAME">Uploader.superclass.constructor.call</span><span class="PUNC">(</span><span class="NAME">self</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">config</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 30</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 31</span> 
<span class='line'> 32</span> 
<span class='line'> 33</span> </span><span class="WHIT">    </span><span class="NAME">S.mix</span><span class="PUNC">(</span><span class="NAME">Uploader</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">/** @lends Uploader*/</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 34</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 35</span>          * 上传方式，{AUTO:'auto', IFRAME:'iframe', AJAX:'ajax', FLASH:'flash'}
<span class='line'> 36</span>          */</span><span class="WHIT">
<span class='line'> 37</span> </span><span class="WHIT">        </span><span class="NAME">type</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">AUTO</span><span class="PUNC">:</span><span class="STRN">'auto'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">IFRAME</span><span class="PUNC">:</span><span class="STRN">'iframe'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">AJAX</span><span class="PUNC">:</span><span class="STRN">'ajax'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">FLASH</span><span class="PUNC">:</span><span class="STRN">'flash'</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 38</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 39</span>          * 组件支持的事件列表，{ RENDER:'render', SELECT:'select', START:'start', PROGRESS : 'progress', COMPLETE:'complete', SUCCESS:'success', UPLOAD_FILES:'uploadFiles', CANCEL:'cancel', ERROR:'error' }
<span class='line'> 40</span>          *
<span class='line'> 41</span>          */</span><span class="WHIT">
<span class='line'> 42</span> </span><span class="WHIT">        </span><span class="NAME">event</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 43</span> </span><span class="WHIT">            </span><span class="COMM">//运行</span><span class="WHIT">
<span class='line'> 44</span> </span><span class="WHIT">            </span><span class="NAME">RENDER</span><span class="PUNC">:</span><span class="STRN">'render'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 45</span> </span><span class="WHIT">            </span><span class="COMM">//选择完文件后触发</span><span class="WHIT">
<span class='line'> 46</span> </span><span class="WHIT">            </span><span class="NAME">SELECT</span><span class="PUNC">:</span><span class="STRN">'select'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 47</span> </span><span class="WHIT">            </span><span class="COMM">//开始上传后触发</span><span class="WHIT">
<span class='line'> 48</span> </span><span class="WHIT">            </span><span class="NAME">START</span><span class="PUNC">:</span><span class="STRN">'start'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 49</span> </span><span class="WHIT">            </span><span class="COMM">//正在上传中时触发</span><span class="WHIT">
<span class='line'> 50</span> </span><span class="WHIT">            </span><span class="NAME">PROGRESS</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'progress'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 51</span> </span><span class="WHIT">            </span><span class="COMM">//上传完成（在上传成功或上传失败后都会触发）</span><span class="WHIT">
<span class='line'> 52</span> </span><span class="WHIT">            </span><span class="NAME">COMPLETE</span><span class="PUNC">:</span><span class="STRN">'complete'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 53</span> </span><span class="WHIT">            </span><span class="COMM">//上传成功后触发</span><span class="WHIT">
<span class='line'> 54</span> </span><span class="WHIT">            </span><span class="NAME">SUCCESS</span><span class="PUNC">:</span><span class="STRN">'success'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 55</span> </span><span class="WHIT">            </span><span class="COMM">//批量上传结束后触发</span><span class="WHIT">
<span class='line'> 56</span> </span><span class="WHIT">            </span><span class="NAME">UPLOAD_FILES</span><span class="PUNC">:</span><span class="STRN">'uploadFiles'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 57</span> </span><span class="WHIT">            </span><span class="COMM">//取消上传后触发</span><span class="WHIT">
<span class='line'> 58</span> </span><span class="WHIT">            </span><span class="NAME">CANCEL</span><span class="PUNC">:</span><span class="STRN">'cancel'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 59</span> </span><span class="WHIT">            </span><span class="COMM">//上传失败后触发</span><span class="WHIT">
<span class='line'> 60</span> </span><span class="WHIT">            </span><span class="NAME">ERROR</span><span class="PUNC">:</span><span class="STRN">'error'</span><span class="WHIT">
<span class='line'> 61</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 62</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 63</span>          * 文件上传所有的状态，{ WAITING : 'waiting', START : 'start', PROGRESS : 'progress', SUCCESS : 'success', CANCEL : 'cancel', ERROR : 'error', RESTORE: 'restore' }
<span class='line'> 64</span>          */</span><span class="WHIT">
<span class='line'> 65</span> </span><span class="WHIT">        </span><span class="NAME">status</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 66</span> </span><span class="WHIT">            </span><span class="NAME">WAITING</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'waiting'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 67</span> </span><span class="WHIT">            </span><span class="NAME">START</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'start'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 68</span> </span><span class="WHIT">            </span><span class="NAME">PROGRESS</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'progress'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 69</span> </span><span class="WHIT">            </span><span class="NAME">SUCCESS</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'success'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 70</span> </span><span class="WHIT">            </span><span class="NAME">CANCEL</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'cancel'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 71</span> </span><span class="WHIT">            </span><span class="NAME">ERROR</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'error'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 72</span> </span><span class="WHIT">            </span><span class="NAME">RESTORE</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'restore'</span><span class="WHIT">
<span class='line'> 73</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 74</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 75</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'> 76</span>      * @name Uploader#select
<span class='line'> 77</span>      * @desc  选择完文件后触发
<span class='line'> 78</span>      * @event
<span class='line'> 79</span>      * @param {Array} ev.files 文件完文件后返回的文件数据
<span class='line'> 80</span>      */</span><span class="WHIT">
<span class='line'> 81</span> 
<span class='line'> 82</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'> 83</span>      * @name Uploader#start
<span class='line'> 84</span>      * @desc  开始上传后触发
<span class='line'> 85</span>      * @event
<span class='line'> 86</span>      * @param {Number} ev.index 要上传的文件在队列中的索引值
<span class='line'> 87</span>      * @param {Object} ev.file 文件数据
<span class='line'> 88</span>      */</span><span class="WHIT">
<span class='line'> 89</span> 
<span class='line'> 90</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'> 91</span>      * @name Uploader#progress
<span class='line'> 92</span>      * @desc  正在上传中时触发，这个事件在iframe上传方式中不存在
<span class='line'> 93</span>      * @event
<span class='line'> 94</span>      * @param {Object} ev.file 文件数据
<span class='line'> 95</span>      * @param {Number} ev.loaded  已经加载完成的字节数
<span class='line'> 96</span>      * @param {Number} ev.total  文件总字节数
<span class='line'> 97</span>      */</span><span class="WHIT">
<span class='line'> 98</span> 
<span class='line'> 99</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>100</span>      * @name Uploader#complete
<span class='line'>101</span>      * @desc  上传完成（在上传成功或上传失败后都会触发）
<span class='line'>102</span>      * @event
<span class='line'>103</span>      * @param {Number} ev.index 上传中的文件在队列中的索引值
<span class='line'>104</span>      * @param {Object} ev.file 文件数据
<span class='line'>105</span>      * @param {Object} ev.result 服务器端返回的数据
<span class='line'>106</span>      */</span><span class="WHIT">
<span class='line'>107</span> 
<span class='line'>108</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>109</span>      * @name Uploader#success
<span class='line'>110</span>      * @desc  上传成功后触发
<span class='line'>111</span>      * @event
<span class='line'>112</span>      * @param {Number} ev.index 上传中的文件在队列中的索引值
<span class='line'>113</span>      * @param {Object} ev.file 文件数据
<span class='line'>114</span>      * @param {Object} ev.result 服务器端返回的数据
<span class='line'>115</span>      */</span><span class="WHIT">
<span class='line'>116</span> 
<span class='line'>117</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>118</span>      * @name Uploader#error
<span class='line'>119</span>      * @desc  上传失败后触发
<span class='line'>120</span>      * @event
<span class='line'>121</span>      * @param {Number} ev.index 上传中的文件在队列中的索引值
<span class='line'>122</span>      * @param {Object} ev.file 文件数据
<span class='line'>123</span>      * @param {Object} ev.result 服务器端返回的数据
<span class='line'>124</span>      */</span><span class="WHIT">
<span class='line'>125</span> 
<span class='line'>126</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>127</span>      * @name Uploader#cancel
<span class='line'>128</span>      * @desc  取消上传后触发
<span class='line'>129</span>      * @event
<span class='line'>130</span>      * @param {Number} ev.index 上传中的文件在队列中的索引值
<span class='line'>131</span>      */</span><span class="WHIT">
<span class='line'>132</span> 
<span class='line'>133</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>134</span>      * @name Uploader#uploadFiles
<span class='line'>135</span>      * @desc  批量上传结束后触发
<span class='line'>136</span>      * @event
<span class='line'>137</span>      */</span><span class="WHIT">
<span class='line'>138</span> </span><span class="WHIT">    </span><span class="COMM">//继承于Base，属性getter和setter委托于Base处理</span><span class="WHIT">
<span class='line'>139</span> </span><span class="WHIT">    </span><span class="NAME">S.extend</span><span class="PUNC">(</span><span class="NAME">Uploader</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">Base</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">/** @lends Uploader.prototype*/</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>140</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>141</span>          * 运行组件，实例化类后必须调用render()才真正运行组件逻辑
<span class='line'>142</span>          * @return {Uploader}
<span class='line'>143</span>          */</span><span class="WHIT">
<span class='line'>144</span> </span><span class="WHIT">        </span><span class="NAME">render</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>145</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">serverConfig</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'serverConfig'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>146</span> </span><span class="WHIT">                </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'type'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>147</span> </span><span class="WHIT">                </span><span class="NAME">UploadType</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.getUploadType</span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">uploadType</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>148</span> </span><span class="WHIT">                </span><span class="NAME">uploaderTypeEvent</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">UploadType.event</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>149</span> </span><span class="WHIT">                </span><span class="NAME">button</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>150</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">UploadType</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>151</span> </span><span class="WHIT">            </span><span class="COMM">//路径input实例</span><span class="WHIT">
<span class='line'>152</span> </span><span class="WHIT">            </span><span class="NAME">self.set</span><span class="PUNC">(</span><span class="STRN">'urlsInput'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">self._renderUrlsInput</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>153</span> </span><span class="WHIT">            </span><span class="NAME">self._renderQueue</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>154</span> </span><span class="WHIT">            </span><span class="NAME">button</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self._renderButton</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>155</span> </span><span class="WHIT">            </span><span class="COMM">// 看看是不是urlsinput里面已经有值了，如果有，恢复到队列中，适用于编辑页面。</span><span class="WHIT">
<span class='line'>156</span> </span><span class="WHIT">            </span><span class="NAME">self._restore</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>157</span> </span><span class="WHIT">            </span><span class="COMM">//如果是flash异步上传方案，增加swfUploader的实例作为参数</span><span class="WHIT">
<span class='line'>158</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'type'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">Uploader.type.FLASH</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>159</span> </span><span class="WHIT">                </span><span class="NAME">S.mix</span><span class="PUNC">(</span><span class="NAME">serverConfig</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">swfUploader</span><span class="PUNC">:</span><span class="NAME">button.get</span><span class="PUNC">(</span><span class="STRN">'swfUploader'</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>160</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>161</span> </span><span class="WHIT">            </span><span class="COMM">//实例化上传方式类</span><span class="WHIT">
<span class='line'>162</span> </span><span class="WHIT">            </span><span class="NAME">uploadType</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">UploadType</span><span class="PUNC">(</span><span class="NAME">serverConfig</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>163</span> </span><span class="WHIT">            </span><span class="COMM">//监听上传器上传完成事件</span><span class="WHIT">
<span class='line'>164</span> </span><span class="WHIT">            </span><span class="NAME">uploadType.on</span><span class="PUNC">(</span><span class="NAME">uploaderTypeEvent.SUCCESS</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">self._uploadCompleteHanlder</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">self</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>165</span> </span><span class="WHIT">            </span><span class="COMM">//监听上传器上传进度事件</span><span class="WHIT">
<span class='line'>166</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">uploaderTypeEvent.PROGRESS</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">uploadType.on</span><span class="PUNC">(</span><span class="NAME">uploaderTypeEvent.PROGRESS</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">self._uploadProgressHandler</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">self</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>167</span> </span><span class="WHIT">            </span><span class="COMM">//监听上传器上传停止事件</span><span class="WHIT">
<span class='line'>168</span> </span><span class="WHIT">            </span><span class="NAME">uploadType.on</span><span class="PUNC">(</span><span class="NAME">uploaderTypeEvent.STOP</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">self._uploadStopHanlder</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">self</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>169</span> </span><span class="WHIT">            </span><span class="NAME">self.set</span><span class="PUNC">(</span><span class="STRN">'uploadType'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">uploadType</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>170</span> </span><span class="WHIT">            </span><span class="NAME">self.fire</span><span class="PUNC">(</span><span class="NAME">Uploader.event.RENDER</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>171</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">self</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>172</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>173</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>174</span>          * 上传指定队列索引的文件
<span class='line'>175</span>          * @param {Number} index 文件对应的在上传队列数组内的索引值
<span class='line'>176</span>          * @example
<span class='line'>177</span>          * //上传队列中的第一个文件，uploader为Uploader的实例
<span class='line'>178</span>          * uploader.upload(0)
<span class='line'>179</span>          */</span><span class="WHIT">
<span class='line'>180</span> </span><span class="WHIT">        </span><span class="NAME">upload</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>181</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">S.isNumber</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>182</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">uploadType</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'uploadType'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>183</span> </span><span class="WHIT">                </span><span class="NAME">queue</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'queue'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>184</span> </span><span class="WHIT">                </span><span class="NAME">file</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">queue.get</span><span class="PUNC">(</span><span class="STRN">'files'</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NAME">index</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>185</span> </span><span class="WHIT">                </span><span class="NAME">uploadParam</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>186</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">S.isPlainObject</span><span class="PUNC">(</span><span class="NAME">file</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>187</span> </span><span class="WHIT">                </span><span class="NAME">S.log</span><span class="PUNC">(</span><span class="NAME">LOG_PREFIX</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'队列中不存在id为'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'的文件'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>188</span> </span><span class="WHIT">                </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>189</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>190</span> </span><span class="WHIT">            </span><span class="COMM">//如果有文件正在上传，予以阻止上传</span><span class="WHIT">
<span class='line'>191</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'curUploadIndex'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">EMPTY</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>192</span> </span><span class="WHIT">                </span><span class="NAME">alert</span><span class="PUNC">(</span><span class="STRN">'第'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'curUploadIndex'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'文件正在上传，请上传完后再操作！'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>193</span> </span><span class="WHIT">                </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>194</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>195</span> </span><span class="WHIT">            </span><span class="COMM">//文件上传域，如果是flash上传,input为文件数据对象</span><span class="WHIT">
<span class='line'>196</span> </span><span class="WHIT">            </span><span class="NAME">uploadParam</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">file.input.id</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">file.input</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>197</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">queue.fileStatus</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">get</span><span class="PUNC">(</span><span class="STRN">'curType'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>198</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'error'</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>199</span> </span><span class="WHIT">                </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>200</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>201</span> </span><span class="WHIT">            </span><span class="COMM">//触发文件上传前事件</span><span class="WHIT">
<span class='line'>202</span> </span><span class="WHIT">            </span><span class="NAME">self.fire</span><span class="PUNC">(</span><span class="NAME">Uploader.event.START</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">index</span><span class="PUNC">:</span><span class="NAME">index</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">file</span><span class="PUNC">:</span><span class="NAME">file</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>203</span> </span><span class="WHIT">            </span><span class="COMM">//阻止文件上传</span><span class="WHIT">
<span class='line'>204</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'isAllowUpload'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>205</span> </span><span class="WHIT">            </span><span class="COMM">//设置当前上传的文件id</span><span class="WHIT">
<span class='line'>206</span> </span><span class="WHIT">            </span><span class="NAME">self.set</span><span class="PUNC">(</span><span class="STRN">'curUploadIndex'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">index</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>207</span> </span><span class="WHIT">            </span><span class="COMM">//改变文件上传状态为start</span><span class="WHIT">
<span class='line'>208</span> </span><span class="WHIT">            </span><span class="NAME">queue.fileStatus</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">Uploader.status.START</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>209</span> </span><span class="WHIT">            </span><span class="COMM">//开始上传</span><span class="WHIT">
<span class='line'>210</span> </span><span class="WHIT">            </span><span class="NAME">uploadType.upload</span><span class="PUNC">(</span><span class="NAME">uploadParam</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>211</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>212</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>213</span>          * 取消文件上传，当index参数不存在时取消当前正在上传的文件的上传。cancel并不会停止其他文件的上传（对应方法是stop）
<span class='line'>214</span>          * @param {Number} index 队列数组索引
<span class='line'>215</span>          * @return {Uploader}
<span class='line'>216</span>          */</span><span class="WHIT">
<span class='line'>217</span> </span><span class="WHIT">        </span><span class="NAME">cancel</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>218</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">uploadType</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'uploadType'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>219</span> </span><span class="WHIT">                </span><span class="NAME">queue</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'queue'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>220</span> </span><span class="WHIT">                </span><span class="NAME">statuses</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Uploader.status</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>221</span> </span><span class="WHIT">                </span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">queue.fileStatus</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>222</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">S.isNumber</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">statuses.SUCCESS</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>223</span> </span><span class="WHIT">                </span><span class="NAME">queue.fileStatus</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">,</span><span class="NAME">statuses.CANCEL</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>224</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>225</span> </span><span class="WHIT">                </span><span class="COMM">//取消上传后刷新状态，更改路径等操作请看_uploadStopHanlder()</span><span class="WHIT">
<span class='line'>226</span> </span><span class="WHIT">                </span><span class="NAME">uploadType.stop</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>227</span> </span><span class="WHIT">                </span><span class="COMM">//存在批量上传操作，继续上传其他文件</span><span class="WHIT">
<span class='line'>228</span> </span><span class="WHIT">                </span><span class="NAME">self._continueUpload</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>229</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>230</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">self</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>231</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>232</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>233</span>          * 停止上传动作
<span class='line'>234</span>          * @return {Uploader}
<span class='line'>235</span>          */</span><span class="WHIT">
<span class='line'>236</span> </span><span class="WHIT">        </span><span class="NAME">stop</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>237</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>238</span> </span><span class="WHIT">            </span><span class="NAME">self.set</span><span class="PUNC">(</span><span class="STRN">'uploadFilesStatus'</span><span class="PUNC">,</span><span class="NAME">EMPTY</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>239</span> </span><span class="WHIT">            </span><span class="NAME">self.cancel</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>240</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">self</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>241</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>242</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>243</span>          * 批量上传队列中的指定状态下的文件
<span class='line'>244</span>          * @param {String} status 文件上传状态名
<span class='line'>245</span>          * @return {Uploader}
<span class='line'>246</span>          * @example
<span class='line'>247</span>          * //上传队列中所有等待的文件
<span class='line'>248</span>          * uploader.uploadFiles("waiting")
<span class='line'>249</span>          */</span><span class="WHIT">
<span class='line'>250</span> </span><span class="WHIT">        </span><span class="NAME">uploadFiles</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">status</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>251</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>252</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">S.isString</span><span class="PUNC">(</span><span class="NAME">status</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Uploader.status.WAITING</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>253</span> </span><span class="WHIT">            </span><span class="NAME">self.set</span><span class="PUNC">(</span><span class="STRN">'uploadFilesStatus'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">status</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>254</span> </span><span class="WHIT">            </span><span class="NAME">self._uploaderStatusFile</span><span class="PUNC">(</span><span class="NAME">status</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>255</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">self</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>256</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>257</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>258</span>          * 上传队列中的指定状态下的文件
<span class='line'>259</span>          * @param {String} status 文件上传状态名
<span class='line'>260</span>          * @return {Uploader}
<span class='line'>261</span>          */</span><span class="WHIT">
<span class='line'>262</span> </span><span class="WHIT">        </span><span class="NAME">_uploaderStatusFile</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">status</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>263</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">queue</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'queue'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>264</span> </span><span class="WHIT">                </span><span class="NAME">fileIndexs</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">queue.getIndexs</span><span class="PUNC">(</span><span class="NAME">status</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>265</span> </span><span class="WHIT">            </span><span class="COMM">//没有存在需要上传的文件，退出上传</span><span class="WHIT">
<span class='line'>266</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">fileIndexs.length</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>267</span> </span><span class="WHIT">                </span><span class="NAME">self.set</span><span class="PUNC">(</span><span class="STRN">'uploadFilesStatus'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">EMPTY</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>268</span> </span><span class="WHIT">                </span><span class="NAME">self.fire</span><span class="PUNC">(</span><span class="NAME">Uploader.event.UPLOAD_FILES</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>269</span> </span><span class="WHIT">                </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>270</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>271</span> </span><span class="WHIT">            </span><span class="COMM">//开始上传等待中的文件</span><span class="WHIT">
<span class='line'>272</span> </span><span class="WHIT">            </span><span class="NAME">self.upload</span><span class="PUNC">(</span><span class="NAME">fileIndexs</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>273</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">self</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>274</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>275</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>276</span>          * 是否支持ajax方案上传
<span class='line'>277</span>          * @return {Boolean}
<span class='line'>278</span>          */</span><span class="WHIT">
<span class='line'>279</span> </span><span class="WHIT">        </span><span class="NAME">isSupportAjax</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>280</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">isSupport</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>281</span> </span><span class="WHIT">            </span><span class="KEYW">try</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>282</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">FormData</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">isSupport</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>283</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="KEYW">catch</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>284</span> </span><span class="WHIT">                </span><span class="NAME">isSupport</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>285</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>286</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">isSupport</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>287</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>288</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>289</span>          * 是否支持flash方案上传
<span class='line'>290</span>          * @return {Boolean}
<span class='line'>291</span>          */</span><span class="WHIT">
<span class='line'>292</span> </span><span class="WHIT">        </span><span class="NAME">isSupportFlash</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>293</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">fpv</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">S.UA.fpv</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>294</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">S.isArray</span><span class="PUNC">(</span><span class="NAME">fpv</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">fpv.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>295</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>296</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>297</span>          * 获取上传方式类（共有iframe、ajax、flash三种方式）
<span class='line'>298</span>          * @type {String} type 上传方式
<span class='line'>299</span>          * @return {IframeType|AjaxType|FlashType}
<span class='line'>300</span>          */</span><span class="WHIT">
<span class='line'>301</span> </span><span class="WHIT">        </span><span class="NAME">getUploadType</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>302</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">types</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Uploader.type</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>303</span> </span><span class="WHIT">                </span><span class="NAME">UploadType</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>304</span> </span><span class="WHIT">            </span><span class="COMM">//如果type参数为auto，那么type=['ajax','flash','iframe']</span><span class="WHIT">
<span class='line'>305</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">types.AUTO</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NAME">types.AJAX</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">types.IFRAME</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>306</span> </span><span class="WHIT">            </span><span class="COMM">//如果是数组，遍历获取浏览器支持的上传方式</span><span class="WHIT">
<span class='line'>307</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">S.isArray</span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">type.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>308</span> </span><span class="WHIT">                </span><span class="NAME">S.each</span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>309</span> </span><span class="WHIT">                    </span><span class="NAME">UploadType</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self._getType</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>310</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">UploadType</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>311</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>312</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>313</span> </span><span class="WHIT">                </span><span class="NAME">UploadType</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self._getType</span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>314</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>315</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">UploadType</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>316</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>317</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>318</span>          * 获取上传方式
<span class='line'>319</span>          * @param {String} type 上传方式（根据type返回对应的上传类，比如iframe返回IframeType）
<span class='line'>320</span>          */</span><span class="WHIT">
<span class='line'>321</span> </span><span class="WHIT">        </span><span class="NAME">_getType</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>322</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">types</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Uploader.type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">UploadType</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>323</span> </span><span class="WHIT">                </span><span class="NAME">isSupportAjax</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.isSupportAjax</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>324</span> </span><span class="WHIT">                </span><span class="NAME">isSupportFlash</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.isSupportFlash</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>325</span> </span><span class="WHIT">            </span><span class="KEYW">switch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>326</span> </span><span class="WHIT">                </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">types.IFRAME</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>327</span> </span><span class="WHIT">                    </span><span class="NAME">UploadType</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">IframeType</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>328</span> </span><span class="WHIT">                    </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>329</span> </span><span class="WHIT">                </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">types.AJAX</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>330</span> </span><span class="WHIT">                    </span><span class="NAME">UploadType</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">isSupportAjax</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">AjaxType</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>331</span> </span><span class="WHIT">                    </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>332</span> </span><span class="WHIT">                </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">types.FLASH</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>333</span> </span><span class="WHIT">                    </span><span class="NAME">UploadType</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">isSupportFlash</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">FlashType</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>334</span> </span><span class="WHIT">                    </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>335</span> </span><span class="WHIT">                </span><span class="KEYW">default</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>336</span> </span><span class="WHIT">                    </span><span class="NAME">S.log</span><span class="PUNC">(</span><span class="NAME">LOG_PREFIX</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'type参数不合法'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>337</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>338</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>339</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">UploadType</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">S.log</span><span class="PUNC">(</span><span class="NAME">LOG_PREFIX</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'使用'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">+</span><span class="STRN">'上传方式'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>340</span> </span><span class="WHIT">            </span><span class="NAME">self.set</span><span class="PUNC">(</span><span class="STRN">'type'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>341</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">UploadType</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>342</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>343</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>344</span>          * 运行Button上传按钮组件
<span class='line'>345</span>          * @return {Button}
<span class='line'>346</span>          */</span><span class="WHIT">
<span class='line'>347</span> </span><span class="WHIT">        </span><span class="NAME">_renderButton</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>348</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">button</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'button'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>349</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">S.isObject</span><span class="PUNC">(</span><span class="NAME">button</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>350</span> </span><span class="WHIT">                </span><span class="NAME">S.log</span><span class="PUNC">(</span><span class="NAME">LOG_PREFIX</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'button参数不合法！'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>351</span> </span><span class="WHIT">                </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>352</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>353</span> </span><span class="WHIT">            </span><span class="COMM">//监听按钮改变事件</span><span class="WHIT">
<span class='line'>354</span> </span><span class="WHIT">            </span><span class="NAME">button.on</span><span class="PUNC">(</span><span class="STRN">'change'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">self._select</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">self</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>355</span> </span><span class="WHIT">            </span><span class="COMM">//运行按钮实例</span><span class="WHIT">
<span class='line'>356</span> </span><span class="WHIT">            </span><span class="NAME">button.render</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>357</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">button</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>358</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>359</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>360</span>          * 运行Queue队列组件
<span class='line'>361</span>          * @return {Queue} 队列实例
<span class='line'>362</span>          */</span><span class="WHIT">
<span class='line'>363</span> </span><span class="WHIT">        </span><span class="NAME">_renderQueue</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>364</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">queue</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'queue'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>365</span> </span><span class="WHIT">                </span><span class="NAME">urlsInput</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'urlsInput'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>366</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">S.isObject</span><span class="PUNC">(</span><span class="NAME">queue</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>367</span> </span><span class="WHIT">                </span><span class="NAME">S.log</span><span class="PUNC">(</span><span class="NAME">LOG_PREFIX</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'queue参数不合法'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>368</span> </span><span class="WHIT">                </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>369</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>370</span> </span><span class="WHIT">            </span><span class="COMM">//将上传组件实例传给队列，方便队列内部执行取消、重新上传的操作</span><span class="WHIT">
<span class='line'>371</span> </span><span class="WHIT">            </span><span class="NAME">queue.set</span><span class="PUNC">(</span><span class="STRN">'uploader'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">self</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>372</span> </span><span class="WHIT">            </span><span class="COMM">//监听队列的删除事件</span><span class="WHIT">
<span class='line'>373</span> </span><span class="WHIT">            </span><span class="NAME">queue.on</span><span class="PUNC">(</span><span class="STRN">'remove'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">ev</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>374</span> </span><span class="WHIT">                </span><span class="COMM">//删除该文件路径，sUrl为服务器端返回的文件路径，而url是客服端文件路径</span><span class="WHIT">
<span class='line'>375</span> </span><span class="WHIT">                </span><span class="NAME">urlsInput.remove</span><span class="PUNC">(</span><span class="NAME">ev.file.sUrl</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>376</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>377</span> </span><span class="WHIT">            </span><span class="NAME">queue.render</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>378</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">queue</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>379</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>380</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>381</span>          * 选择完文件后
<span class='line'>382</span>          * @param {Object} ev 事件对象
<span class='line'>383</span>          */</span><span class="WHIT">
<span class='line'>384</span> </span><span class="WHIT">        </span><span class="NAME">_select</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">ev</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>385</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">autoUpload</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'autoUpload'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>386</span> </span><span class="WHIT">                </span><span class="NAME">queue</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'queue'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>387</span> </span><span class="WHIT">                </span><span class="NAME">curId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'curUploadIndex'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>388</span> </span><span class="WHIT">                </span><span class="NAME">files</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ev.files</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>389</span> </span><span class="WHIT">            </span><span class="NAME">S.each</span><span class="PUNC">(</span><span class="NAME">files</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">file</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>390</span> </span><span class="WHIT">                </span><span class="COMM">//文件大小，IE浏览器下不存在</span><span class="WHIT">
<span class='line'>391</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">file.size</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">file.size</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>392</span> </span><span class="WHIT">                </span><span class="COMM">//chrome文件名属性名为fileName，而firefox为name</span><span class="WHIT">
<span class='line'>393</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">file.name</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">file.name</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">file.fileName</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">EMPTY</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>394</span> </span><span class="WHIT">                </span><span class="COMM">//如果是flash上传，并不存在文件上传域input</span><span class="WHIT">
<span class='line'>395</span> </span><span class="WHIT">                </span><span class="NAME">file.input</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ev.input</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">file</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>396</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>397</span> </span><span class="WHIT">            </span><span class="NAME">self.fire</span><span class="PUNC">(</span><span class="NAME">Uploader.event.SELECT</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">files</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">files</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>398</span> </span><span class="WHIT">            </span><span class="COMM">//阻止文件上传</span><span class="WHIT">
<span class='line'>399</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'isAllowUpload'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>400</span> </span><span class="WHIT">            </span><span class="NAME">queue.add</span><span class="PUNC">(</span><span class="NAME">files</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>401</span> </span><span class="WHIT">                </span><span class="COMM">//如果不存在正在上传的文件，且允许自动上传，上传该文件</span><span class="WHIT">
<span class='line'>402</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">curId</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">EMPTY</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">autoUpload</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>403</span> </span><span class="WHIT">                    </span><span class="NAME">self.uploadFiles</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>404</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>405</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>406</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>407</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>408</span>          * 向上传按钮容器内增加用于存储文件路径的input
<span class='line'>409</span>          */</span><span class="WHIT">
<span class='line'>410</span> </span><span class="WHIT">        </span><span class="NAME">_renderUrlsInput</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>411</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">button</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'button'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">inputWrapper</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">button.get</span><span class="PUNC">(</span><span class="STRN">'target'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>412</span> </span><span class="WHIT">                </span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'urlsInputName'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>413</span> </span><span class="WHIT">                </span><span class="NAME">urlsInput</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">UrlsInput</span><span class="PUNC">(</span><span class="NAME">inputWrapper</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">name</span><span class="PUNC">:</span><span class="NAME">name</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>414</span> </span><span class="WHIT">            </span><span class="NAME">urlsInput.render</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>415</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">urlsInput</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>416</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>417</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>418</span>          * 当上传完毕后返回结果集的处理
<span class='line'>419</span>          */</span><span class="WHIT">
<span class='line'>420</span> </span><span class="WHIT">        </span><span class="NAME">_uploadCompleteHanlder</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">ev</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>421</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ev.result</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">status</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">event</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Uploader.event</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>422</span> </span><span class="WHIT">                </span><span class="NAME">queue</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'queue'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'curUploadIndex'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>423</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">S.isObject</span><span class="PUNC">(</span><span class="NAME">result</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>424</span> </span><span class="WHIT">            </span><span class="COMM">//将服务器端的数据保存到队列中的数据集合</span><span class="WHIT">
<span class='line'>425</span> </span><span class="WHIT">            </span><span class="NAME">queue.updateFile</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">,</span><span class="PUNC">{</span><span class="NAME">result</span><span class="PUNC">:</span><span class="NAME">result</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>426</span> </span><span class="WHIT">            </span><span class="COMM">//文件上传状态</span><span class="WHIT">
<span class='line'>427</span> </span><span class="WHIT">            </span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Number</span><span class="PUNC">(</span><span class="NAME">result.status</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>428</span> </span><span class="WHIT">            </span><span class="COMM">// 只有上传状态为1时才是成功的</span><span class="WHIT">
<span class='line'>429</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>430</span> </span><span class="WHIT">                </span><span class="COMM">//修改队列中文件的状态为success（上传完成）</span><span class="WHIT">
<span class='line'>431</span> </span><span class="WHIT">                </span><span class="NAME">queue.fileStatus</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">Uploader.status.SUCCESS</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>432</span> </span><span class="WHIT">                </span><span class="NAME">self._success</span><span class="PUNC">(</span><span class="NAME">result.data</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>433</span> </span><span class="WHIT">                </span><span class="NAME">self.fire</span><span class="PUNC">(</span><span class="NAME">event.SUCCESS</span><span class="PUNC">,</span><span class="PUNC">{</span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">index</span><span class="PUNC">,</span><span class="NAME">file</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">queue.getFile</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="NAME">result</span><span class="PUNC">:</span><span class="NAME">result</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>434</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>435</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">msg</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">result.msg</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">result.message</span><span class="WHIT">  </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">EMPTY</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>436</span> </span><span class="WHIT">                </span><span class="COMM">//修改队列中文件的状态为error（上传失败）</span><span class="WHIT">
<span class='line'>437</span> </span><span class="WHIT">                </span><span class="NAME">queue.fileStatus</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">Uploader.status.ERROR</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">msg</span><span class="PUNC">:</span><span class="NAME">msg</span><span class="PUNC">,</span><span class="NAME">result</span><span class="PUNC">:</span><span class="NAME">result</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>438</span> </span><span class="WHIT">                </span><span class="NAME">self.fire</span><span class="PUNC">(</span><span class="NAME">event.ERROR</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">status</span><span class="PUNC">:</span><span class="NAME">status</span><span class="PUNC">,</span><span class="NAME">result</span><span class="PUNC">:</span><span class="NAME">result</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>439</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>440</span> </span><span class="WHIT">            </span><span class="COMM">//置空当前上传的文件在队列中的索引值</span><span class="WHIT">
<span class='line'>441</span> </span><span class="WHIT">            </span><span class="NAME">self.set</span><span class="PUNC">(</span><span class="STRN">'curUploadIndex'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">EMPTY</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>442</span> </span><span class="WHIT">            </span><span class="NAME">self.fire</span><span class="PUNC">(</span><span class="NAME">event.COMPLETE</span><span class="PUNC">,</span><span class="PUNC">{</span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">index</span><span class="PUNC">,</span><span class="NAME">file</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">queue.getFile</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="NAME">result</span><span class="PUNC">:</span><span class="NAME">result</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>443</span> </span><span class="WHIT">            </span><span class="COMM">//存在批量上传操作，继续上传</span><span class="WHIT">
<span class='line'>444</span> </span><span class="WHIT">            </span><span class="NAME">self._continueUpload</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>445</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>446</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>447</span>          * 取消上传后调用的方法
<span class='line'>448</span>          */</span><span class="WHIT">
<span class='line'>449</span> </span><span class="WHIT">        </span><span class="NAME">_uploadStopHanlder</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>450</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">queue</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'queue'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>451</span> </span><span class="WHIT">                </span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'curUploadIndex'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>452</span> </span><span class="WHIT">            </span><span class="COMM">//更改取消上传后的状态</span><span class="WHIT">
<span class='line'>453</span> </span><span class="WHIT">            </span><span class="NAME">queue.fileStatus</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">Uploader.status.CANCEL</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>454</span> </span><span class="WHIT">            </span><span class="COMM">//重置当前上传文件id</span><span class="WHIT">
<span class='line'>455</span> </span><span class="WHIT">            </span><span class="NAME">self.set</span><span class="PUNC">(</span><span class="STRN">'curUploadIndex'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">EMPTY</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>456</span> </span><span class="WHIT">            </span><span class="NAME">self.fire</span><span class="PUNC">(</span><span class="NAME">Uploader.event.CANCEL</span><span class="PUNC">,</span><span class="PUNC">{</span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">index</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>457</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>458</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>459</span>          * 如果存在批量上传，则继续上传
<span class='line'>460</span>          */</span><span class="WHIT">
<span class='line'>461</span> </span><span class="WHIT">        </span><span class="NAME">_continueUpload</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>462</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>463</span> </span><span class="WHIT">                </span><span class="NAME">uploadFilesStatus</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'uploadFilesStatus'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>464</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">uploadFilesStatus</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">EMPTY</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>465</span> </span><span class="WHIT">                </span><span class="NAME">self._uploaderStatusFile</span><span class="PUNC">(</span><span class="NAME">uploadFilesStatus</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>466</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>467</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>468</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>469</span>          * 上传进度监听器
<span class='line'>470</span>          */</span><span class="WHIT">
<span class='line'>471</span> </span><span class="WHIT">        </span><span class="NAME">_uploadProgressHandler</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">ev</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>472</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">queue</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'queue'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>473</span> </span><span class="WHIT">                </span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'curUploadIndex'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>474</span> </span><span class="WHIT">                </span><span class="NAME">file</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">queue.getFile</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>475</span> </span><span class="WHIT">            </span><span class="NAME">S.mix</span><span class="PUNC">(</span><span class="NAME">ev</span><span class="PUNC">,</span><span class="PUNC">{</span><span class="NAME">file</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">file</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>476</span> </span><span class="WHIT">            </span><span class="NAME">queue.fileStatus</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">Uploader.status.PROGRESS</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ev</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>477</span> </span><span class="WHIT">            </span><span class="NAME">self.fire</span><span class="PUNC">(</span><span class="NAME">Uploader.event.PROGRESS</span><span class="PUNC">,</span><span class="NAME">ev</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>478</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>479</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>480</span>          * 上传成功后执行的回调函数
<span class='line'>481</span>          * @param {Object} data 服务器端返回的数据
<span class='line'>482</span>          */</span><span class="WHIT">
<span class='line'>483</span> </span><span class="WHIT">        </span><span class="NAME">_success</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>484</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">S.isObject</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>485</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">url</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data.url</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>486</span> </span><span class="WHIT">                </span><span class="NAME">urlsInput</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'urlsInput'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>487</span> </span><span class="WHIT">                </span><span class="NAME">fileIndex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'curUploadIndex'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>488</span> </span><span class="WHIT">                </span><span class="NAME">queue</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'queue'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>489</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">S.isString</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">S.isObject</span><span class="PUNC">(</span><span class="NAME">urlsInput</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>490</span> </span><span class="WHIT">            </span><span class="COMM">//追加服务器端返回的文件url</span><span class="WHIT">
<span class='line'>491</span> </span><span class="WHIT">            </span><span class="NAME">queue.updateFile</span><span class="PUNC">(</span><span class="NAME">fileIndex</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="STRN">'sUrl'</span><span class="PUNC">:</span><span class="NAME">url</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>492</span> </span><span class="WHIT">            </span><span class="COMM">//向路径隐藏域添加路径</span><span class="WHIT">
<span class='line'>493</span> </span><span class="WHIT">            </span><span class="NAME">urlsInput.add</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>494</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>495</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>496</span>          * 检查是否有已经存在的图片恢复到队列中
<span class='line'>497</span>          */</span><span class="WHIT">
<span class='line'>498</span> </span><span class="WHIT">        </span><span class="NAME">_restore</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>499</span> </span><span class="WHIT">        	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>500</span> </span><span class="WHIT">        		</span><span class="NAME">urlsInput</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'urlsInput'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>501</span> </span><span class="WHIT">        		</span><span class="NAME">filesExists</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">urlsInput.parse</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>502</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">filesExists</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">filesExists.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>503</span> </span><span class="WHIT">            	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">queue</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'queue'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>504</span> </span><span class="WHIT">            	</span><span class="NAME">queue.restore</span><span class="PUNC">(</span><span class="NAME">filesExists</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>505</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>506</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>507</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">ATTRS</span><span class="PUNC">:</span><span class="COMM">/** @lends Uploader.prototype*/</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>508</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>509</span>          * Button按钮的实例
<span class='line'>510</span>          * @type Button
<span class='line'>511</span>          * @default {}
<span class='line'>512</span>          */</span><span class="WHIT">
<span class='line'>513</span> </span><span class="WHIT">        </span><span class="NAME">button</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">value</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>514</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>515</span>          * Queue队列的实例
<span class='line'>516</span>          * @type Queue
<span class='line'>517</span>          * @default {}
<span class='line'>518</span>          */</span><span class="WHIT">
<span class='line'>519</span> </span><span class="WHIT">        </span><span class="NAME">queue</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">value</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>520</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>521</span>          * 采用的上传方案，当值是数组时，比如“type” : ["flash","ajax","iframe"]，按顺序获取浏览器支持的方式，该配置会优先使用flash上传方式，如果浏览器不支持flash，会降级为ajax，如果还不支持ajax，会降级为iframe；当值是字符串时，比如“type” : “ajax”，表示只使用ajax上传方式。这种方式比较极端，在不支持ajax上传方式的浏览器会不可用；当“type” : “auto”，auto是一种特例，等价于["ajax","iframe"]。
<span class='line'>522</span>          * @type String|Array
<span class='line'>523</span>          * @default "auto"
<span class='line'>524</span>          */</span><span class="WHIT">
<span class='line'>525</span> </span><span class="WHIT">        </span><span class="NAME">type</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">value</span><span class="PUNC">:</span><span class="NAME">Uploader.type.AUTO</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>526</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>527</span>          * 服务器端配置。action：服务器处理上传的路径；data： post给服务器的参数，通常需要传递用户名、token等信息
<span class='line'>528</span>          * @type Object
<span class='line'>529</span>          * @default  {action:EMPTY, data:{}, dataType:'json'}
<span class='line'>530</span>          */</span><span class="WHIT">
<span class='line'>531</span> </span><span class="WHIT">        </span><span class="NAME">serverConfig</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">value</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">action</span><span class="PUNC">:</span><span class="NAME">EMPTY</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">dataType</span><span class="PUNC">:</span><span class="STRN">'json'</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>532</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>533</span>          * 是否允许上传文件
<span class='line'>534</span>          * @type Boolean
<span class='line'>535</span>          * @default true
<span class='line'>536</span>          */</span><span class="WHIT">
<span class='line'>537</span> </span><span class="WHIT">        </span><span class="NAME">isAllowUpload</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">value</span><span class="PUNC">:</span><span class="KEYW">true</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>538</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>539</span>          * 是否自动上传
<span class='line'>540</span>          * @type Boolean
<span class='line'>541</span>          * @default true
<span class='line'>542</span>          */</span><span class="WHIT">
<span class='line'>543</span> </span><span class="WHIT">        </span><span class="NAME">autoUpload</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">value</span><span class="PUNC">:</span><span class="KEYW">true</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>544</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>545</span>          * 存储文件路径的隐藏域的name名
<span class='line'>546</span>          * @type String
<span class='line'>547</span>          * @default ""
<span class='line'>548</span>          */</span><span class="WHIT">
<span class='line'>549</span> </span><span class="WHIT">        </span><span class="NAME">urlsInputName</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">value</span><span class="PUNC">:</span><span class="NAME">EMPTY</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>550</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>551</span>          *  当前上传的文件对应的在数组内的索引值，如果没有文件正在上传，值为空
<span class='line'>552</span>          *  @type Number
<span class='line'>553</span>          *  @default ""
<span class='line'>554</span>          */</span><span class="WHIT">
<span class='line'>555</span> </span><span class="WHIT">        </span><span class="NAME">curUploadIndex</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">value</span><span class="PUNC">:</span><span class="NAME">EMPTY</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>556</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>557</span>          * 上传方式实例
<span class='line'>558</span>          * @type UploaderType
<span class='line'>559</span>          * @default {}
<span class='line'>560</span>          */</span><span class="WHIT">
<span class='line'>561</span> </span><span class="WHIT">        </span><span class="NAME">uploadType</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">value</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>562</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>563</span>          * UrlsInput实例
<span class='line'>564</span>          * @type UrlsInput
<span class='line'>565</span>          * @default ""
<span class='line'>566</span>          */</span><span class="WHIT">
<span class='line'>567</span> </span><span class="WHIT">        </span><span class="NAME">urlsInput</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">value</span><span class="PUNC">:</span><span class="NAME">EMPTY</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>568</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>569</span>          * 存在批量上传文件时，指定的文件状态
<span class='line'>570</span>          * @type String
<span class='line'>571</span>          * @default ""
<span class='line'>572</span>          */</span><span class="WHIT">
<span class='line'>573</span> </span><span class="WHIT">        </span><span class="NAME">uploadFilesStatus</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">value</span><span class="PUNC">:</span><span class="NAME">EMPTY</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>574</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>575</span> 
<span class='line'>576</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>577</span>      * 转换文件大小字节数
<span class='line'>578</span>      * @param {Number} bytes 文件大小字节数
<span class='line'>579</span>      * @return {String} 文件大小
<span class='line'>580</span>      */</span><span class="WHIT">
<span class='line'>581</span> </span><span class="WHIT">    </span><span class="NAME">S.convertByteSize</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">bytes</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>582</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>583</span> </span><span class="WHIT">        </span><span class="KEYW">do</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>584</span> </span><span class="WHIT">            </span><span class="NAME">bytes</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">bytes</span><span class="WHIT"> </span><span class="PUNC">/</span><span class="WHIT"> </span><span class="NUMB">1024</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>585</span> </span><span class="WHIT">            </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>586</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">while</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">bytes</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">99</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>587</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">Math.max</span><span class="PUNC">(</span><span class="NAME">bytes</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">0.1</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">toFixed</span><span class="PUNC">(</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="STRN">'kB'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'MB'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'GB'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'TB'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'PB'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'EB'</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>588</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>589</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">Uploader</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>590</span> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">requires</span><span class="PUNC">:</span><span class="PUNC">[</span><span class="STRN">'base'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'node'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'./urlsInput'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'./type/iframe'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'./type/ajax'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'./type/flash'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'flash'</span><span class="PUNC">]</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>591</span> </span></pre></body></html>